package com.gnerv.battle.boot.module.base.model.bo;

import com.gnerv.battle.boot.module.base.model.entity.Role;
import com.gnerv.battle.boot.common.tools.DateTimeTools;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author Gnerv LiGen
 */
@Data
public class RoleBO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    private String ukId;
    private String name;
    private String description;
    private String status;
    private Integer sort;

    public Role toCreateRole() {
        Role role = new Role();
        BeanUtils.copyProperties(this, role);
        role.setGmtCreate(DateTimeTools.currentTimeMillis());
        role.setGmtModified(DateTimeTools.currentTimeMillis());
        return role;
    }

    public Role toUpdateRole() {
        Role role = new Role();
        BeanUtils.copyProperties(this, role);
        role.setGmtModified(DateTimeTools.currentTimeMillis());
        return role;
    }
}